import {Injectable, Logger} from "@nestjs/common";
import {Cron, Interval, Timeout, CronExpression} from "@nestjs/schedule";
import {InjectRepository} from "@nestjs/typeorm";
import {Repository} from "typeorm";
import dayjs from "dayjs";
import cluster from "cluster";

@Injectable()
export class TasksService {
	constructor() {
	}
	
	// 重置卡密每日解析次数
	@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT, {
		timeZone: "Asia/Shanghai"
	}) // 每天的 00:00 执行定时任务
	async resetPanCodeParseNum() {
		if (!cluster.isMaster) return;
		console.log("卡密每日解析次数，已重置...");
		
	}
	
	@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT, {
		timeZone: "Asia/Shanghai"
	}) // 每天的 00:00 执行定时任务
	// @Timeout(5000)
	async resetSvipAccount() {
		if (!cluster.isMaster) return;
		
	}
}